package com.maiworld.api.controller;

import java.util.Map;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.dubbo.config.annotation.Reference;
import com.maiworld.seller.service.ReleaseNawsService;

@RestController
@RequestMapping("/rele")
public class ReleaseNawsController {

	@Reference
	private ReleaseNawsService releaseNawsService;
	
	//获取某个教练发布的还没有过期的所有任务信息 cid:代表教练的主键 这里一个教练在某一个阶段只能教科目 (测试通过)
	@RequestMapping("/findRele")
	public Map<String, Object> findRele(Long id ,Long cid, Long sid, String status, String openid,String date,String subject){
		return releaseNawsService.findComment(id,cid, sid, status, openid,date,subject);
	}
	
	//教练发布信息           (测试通过)
	@RequestMapping(value="plan",method=RequestMethod.POST)
	public Map<String, Object> plan(
			@RequestBody String parmes
			){		
		//System.out.print(parmes);
		return  releaseNawsService.findCoachRelease(parmes);
	}
	
	//重新发布工单         (测试通过)
	@RequestMapping(value = "replan" ,method=RequestMethod.POST)
	public Map<String, Object> replan(
			@RequestBody String parmes
			){		
		System.out.print(parmes);
		return releaseNawsService.deleteRele(parmes);
	}
	
	//获取教练的任务工单(测试通过)
	@RequestMapping("/getplan")
	public Map<String, Object> getplan(Long cid, String date, String status , String openid,String session_key){
		return releaseNawsService.getplan(cid, date, status ,openid);
		
	}
}
